<template>
  <div>
    <button @click="fetchData">获取用户信息</button>
    <pre>{{ response }}</pre>
  </div>
</template>

<script lang="ts">import { defineComponent, ref } from 'vue';
import { rq } from './utils/request.ts'; // 替换为实际路径

export default defineComponent({
  setup() {
    const response = ref(null);

    const fetchData = async () => {
      try {
        const result = await rq('/inthepink/myUser', 'GET');
        response.value = result.data;
      } catch (error) {
        console.error('请求失败:', error);
      }
    };

    return {
      response,
      fetchData,
    };
  },
});
</script>

<style scoped>/* 可以在这里添加样式 */
</style>